<extend name="_Layout/layout"/>
<block name="style">
<style type="text/css">
			[class*=am-u-]{padding-left:0;padding-right: 0;}
			ol, ul{padding: 0; margin: 0;}
			.m-middlem{ margin-bottom: 50px;}
			.m-middlem h2{color: #000; margin-bottom: 0; padding: 20px 0 10px 0;  font-size: 22px;}
			.m-middlem .con{ height: auto; overflow: hidden;}
			.m-middlem .con p{ line-height: 35px; font-size: 14px; color: :#ccc; margin: 3px 0; text-indent: 2em;}
			.m-middlem .con img{ display: block; width: auto; max-width: 100%; margin: 15px auto;}
			.m-middlem  h3 span{ font-size: 13px; padding-right: 20px;}
			.m-middlem  h3{border-bottom: 1px solid #e5e5e5; margin-top: 0; padding-bottom: 20px;}
		</style>
</block>
 <block name="main">
<div class="raise right clearfix">
<h2>修改密码</h2>
<div class="support_ybc pass_ybc">
	<ul id="pass_change">
		<li class="selectTag">
			<a onclick="selectTag('tagContent0',this)" href="javascript:void(0)">修改密码</a>
		</li>
		<li class="note">
			<a onclick="selectTag('tagContent1',this)" href="javascript:void(0)">修改交易密码</a>
		</li>
		<div class="clear"></div>
	</ul>
	<div id="tagContent" class="passContent">
		<!-- 修改登录密码 -->
		<div class="tagContent selectTag" id="tagContent0" style="display:block" >
			<form method="post" onsubmit="return false;" onkeydown="if (event.keyCode == 13) {return false;}">
				<ul class="ybc_con" >
					<li>
						<label for="password">登录密码：</label>
						<input type="password" name="oldpwd">
					</li>
					<li>
						<label for="newword">新密码：</label>
						<input type="password" name="pwd">
						<span class="note" style="padding-left:10px;">密码长度在6-20个字符之间</span>
					</li>
					<li>
						<label for="repeat">重复密码：</label>
						<input type="password" name="repwd">
					</li>
					<li id="phone_alert">
						<label>短信验证码：</label>
						<span style="float:left;margin-left:0px;">
							<input type="text" class="" name="phone_code" style="margin:0px;width:165px;" placeholder="请输入验证码" id="phone_code_login">
						</span>
						<span class="retry-send" style="float:left;margin-left: 0px;">
							<!--<input type="button" style="width: 100px;font-size: 12px;line-height: 0px;" class="verify phone_code" value="获取短信验证码" onclick="coinOut.getPhoneCode()"/>-->
							<div style="width: 100px;height:42px;line-height:42px;font-size: 12px;" class="verify phone_code" name="getPhoneCode" onclick="Password.getPhoneCode(this)">获取短信验证码</div>
						</span>
						<br>
					</li>
					<li>
						<label class="buys">&nbsp;</label>
						<input type="submit" class="tijiao" value="提交" onclick="type1()">
					</li>
				</ul>
			</form>
		</div>
		<!-- 修改交易密码 -->
		<div class="tagContent" id="tagContent1" style="display:none">
			<form method="post" onsubmit="return false;" onkeydown="if (event.keyCode == 13) { return false; }">
				<ul class="ybc_con">
						<li>
							<label for="buypassword">原交易密码：</label>
							<input type="password" name="oldpwdtrade" value="">
	                    	<!-- <span class="note">
	                    		<a href="/user/repwdtrade" class="voices" style="margin-left:10px;">忘记交易密码</a>
	                    	</span> -->
						</li>
						<li>
							<label for="newword">新交易密码：</label>
							<input type="password" name="pwd1" value="">
							<span class="note" style="padding-left:10px;">密码长度在6-20个字符之间</span>
						</li>
						<li>
							<label for="repeat">重复交易密码：</label>
							<input type="password" name="repwd1" value="">
						</li>
						<li id="phone_alert">
							<label>短信验证码：</label>
							<span style="float:left;margin-left:0px;">
								<input type="text" class="" name="phone_code" style="margin:0px;width:165px;" placeholder="请输入验证码" id="phone_code_trade">
							</span>
							<span class="retry-send" style="float:left;margin-left: 0px;">
								<div style="width: 100px;height:42px;line-height:42px;font-size: 12px;" class="verify phone_code" name="getPhoneCode" onclick="Password.gettradePhoneCode(this)">获取短信验证码</div>
							</span>
							<br>
						</li>
						<li>
							<label class="buys">&nbsp;</label>
							<input type="submit" id="" class="tijiao" value="提交" onclick="type2()">
						</li>
					</ul>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript" src="./Application/Home/View/default/_Resource/js/tab2.js"></script>
<script src="./Application/Home/View/default/_Resource/js/layer.js"></script>
<script src="./Application/Home/View/default/_Resource/js/password.js"></script>
<script type="text/javascript" src="./Application/Home/View/default/_Resource/js/ajaxfileupload.js"></script>
<script >

function type1(){
	var old=$('input[name=oldpwd]').val();
	var password=$('input[name=pwd]').val();
	var repassword=$('input[name=repwd]').val();
	var psd_type=1;
	if(old == '')
	{
		alert('请输入原密码');
	}else if(password == '')
	{
		alert('请输入新密码');
	}else if(repassword == '')
	{
		alert('请输入重复密码');
	}else if(password != repassword)
	{
		alert('您输入的新密码与确认密码不一致');
	}else if(old && password && repassword && psd_type)
	{
		$.getJSON("{:U('Home/User/updatepwd')}",{old:old,password:password,repassword:repassword,psd_type:psd_type},function(json){
			alert(json.msg);
			$('input[name=oldpwd]').val("");
			$('input[name=pwd]').val("");
			$('input[name=repwd]').val("");
   		 });
	}	
}
function type2(){
	var old=$('input[name=oldpwdtrade]').val();
	
	var password=$('input[name=pwd1]').val();
	
	var repassword=$('input[name=repwd1]').val();	
	
	alert(password);
	
	
	var psd_type=2;
	if(old == '')
	{
		alert('请输入原密码');
	}else if(password == '')
	{
		alert('请输入新密码');
	}else if(repassword == '')
	{
		alert('请输入重复密码');
	}else if(password != repassword)
	{
		alert('您输入的新密码与确认密码不一致');
	}else if(old && password && repassword && psd_type)
	{
		$.getJSON("{:U('Home/User/updatepwd')}",{old:old,password:password,repassword:repassword,psd_type:psd_type},function(json){
			alert(json.msg);
			$('input[name=oldpwdtrade]').val("");
			$('input[name=pwd]').val("");
			$('input[name=repwd]').val("");
   		 });
	}	
}
</script>
</div>



</block>